﻿using System.ComponentModel.Composition;
using iStudio.Structure.Command;

namespace iStudio.Module.Effect
{
    /// <summary>
    /// Interaction logic for Basic.xaml
    /// </summary>
    [Export(typeof(Structure.Engine.Module))]
    public class EffectModule : Structure.Engine.Module
    {
        public EffectModule()
        {
            //
            // We created a single command and hooked it into main menu Functions / Basic
            // And Basic of the TrackEditor context menu
            //

            AddCommand ("Effect", "Functions/Effect");
            AddCommand ("Effect", "Functions/Effect", ModuleCommandType.FromCommandId("TrackEditorSelect"));
        
            //
            // Do not setup window here, if it has any bindings to other elements of the engine
            //
        }

        protected override void OnExecutedCommand(ModuleCommand command)
        {
            //
            // Check if module window is setuped -> singleton
            //

            if (!HasModuleWindow())
            {
                SetupModuleWindow (new EffectWindow (this));
            }

            switch (command.Name)
            {
                case "Effect":
                    OpenModuleWindow ();
                    break;
            }
        }
    }
}
